package config

// 商城版本
const ShopVersion = 1000000

// 限购类型
const (
	BuyLimitTypeInvalid = 0
	BuyLimitTypeDay     = 1
	BuyLimitTypeWeek    = 2
	BuyLimitTypeMonth   = 3
	BuyLimitTypeYear    = 4
)

// 道具ID
const (
	IDMoney          = 1000 // 游戏豆
	IDCoin           = 1001 // 金币
	IDExpCard        = 1010 // 双倍经验卡
	IDRenameCard     = 1003 // 改名卡
	IDGameClearCard  = 1004 // 战绩清零卡
	IDYearVIP        = 1005 // 年会员
	IDMonthVIP       = 1006 // 月会员
	IDYearVIPPackage = 1007 // 年会员大礼包
	IDMonthVIPPackage = 1008 // 月会员大礼包
)

// 道具类型
const (
	TypeUse  = 1 // 消耗型
	TypeTime = 2 // 时间型
)

// 支付类型
const (
	TypePayMoney = 1
	TypePayCoin  = 2
	TypePayRMB   = 3
)

// 无库存限制
const NoInventory = -1

// ShopItem 商城道具配置
type ShopItem struct {
	PID         int                    `json:"pid"`
	EName       string                 `json:"ename"`
	Name        string                 `json:"name"`
	Type        int                    `json:"type"`
	Pay         map[int]int            `json:"pay"` // paytype -> amount
	Money       int                    `json:"money"`
	Coin        int                    `json:"coin"`
	RMB         int                    `json:"rmb"`
	PayType     []int                  `json:"paytype"`
	IconID      int                    `json:"iconid"`
	Version     int                    `json:"version"`
	Discount    float64                `json:"discount"`
	Inventory   int                    `json:"inventory"`
	BuyLimitType int                   `json:"buylimittype"`
	BuyLimitNum  int                   `json:"buylimitnum"`
	PropList    []PropInfo             `json:"proplist"`
	InitNum     int                    `json:"initnum"`
}

// PropInfo 道具信息
type PropInfo struct {
	PID int `json:"pid"`
	Num int `json:"num"`
}

var ShopList = []int{
	IDMoney, IDCoin, IDExpCard, IDRenameCard,
	IDGameClearCard, IDYearVIPPackage, IDMonthVIPPackage,
}

var ShopInitList = []int{
	IDMoney, IDCoin, IDExpCard, IDRenameCard,
	IDGameClearCard, IDYearVIPPackage, IDMonthVIPPackage,
}

var ShopCfg = map[int]ShopItem{
	IDMoney: {
		PID: IDMoney, EName: "money", Name: "游戏豆",
		Type: TypeUse,
		Pay: map[int]int{TypePayMoney: -1, TypePayCoin: 1, TypePayRMB: 1},
		Money: -1, Coin: 1, RMB: 1,
		PayType: []int{TypePayCoin, TypePayRMB},
		IconID: 1000, Version: 10000, Discount: 1,
		Inventory: NoInventory, BuyLimitType: BuyLimitTypeInvalid, BuyLimitNum: -1,
		PropList: []PropInfo{{PID: IDMoney, Num: 1}},
		InitNum: 10000,
	},
	IDCoin: {
		PID: IDCoin, EName: "coin", Name: "金币",
		Type: TypeUse,
		Pay: map[int]int{TypePayMoney: -1, TypePayCoin: -1, TypePayRMB: 1},
		Money: -1, Coin: -1, RMB: 1,
		PayType: []int{TypePayRMB},
		IconID: 1001, Version: 10000, Discount: 1,
		Inventory: NoInventory, BuyLimitType: BuyLimitTypeInvalid, BuyLimitNum: -1,
		PropList: []PropInfo{{PID: IDCoin, Num: 1}},
		InitNum: 10,
	},
	IDExpCard: {
		PID: IDExpCard, EName: "expcard", Name: "双倍经验卡",
		Type: TypeTime,
		Pay: map[int]int{TypePayMoney: 100, TypePayCoin: -1, TypePayRMB: -1},
		Money: 100, Coin: -1, RMB: -1,
		PayType: []int{TypePayMoney},
		IconID: 1002, Version: 10000, Discount: 1,
		Inventory: 100, BuyLimitType: BuyLimitTypeInvalid, BuyLimitNum: -1,
		PropList: []PropInfo{{PID: IDExpCard, Num: 1}},
		InitNum: 0,
	},
	IDRenameCard: {
		PID: IDRenameCard, EName: "renamecard", Name: "改名卡",
		Type: TypeUse,
		Pay: map[int]int{TypePayMoney: 1000, TypePayCoin: -1, TypePayRMB: -1},
		Money: 1000, Coin: -1, RMB: -1,
		PayType: []int{TypePayMoney},
		IconID: 1003, Version: 10000, Discount: 1,
		Inventory: NoInventory, BuyLimitType: BuyLimitTypeInvalid, BuyLimitNum: -1,
		PropList: []PropInfo{{PID: IDRenameCard, Num: 1}},
		InitNum: 0,
	},
	IDGameClearCard: {
		PID: IDGameClearCard, EName: "gameclearcard", Name: "战绩清零卡",
		Type: TypeUse,
		Pay: map[int]int{TypePayMoney: 1000, TypePayCoin: -1, TypePayRMB: -1},
		Money: 1000, Coin: -1, RMB: -1,
		PayType: []int{TypePayMoney},
		IconID: 1004, Version: 10000, Discount: 1,
		Inventory: NoInventory, BuyLimitType: BuyLimitTypeInvalid, BuyLimitNum: -1,
		PropList: []PropInfo{{PID: IDGameClearCard, Num: 1}},
		InitNum: 0,
	},
	IDYearVIPPackage: {
		PID: IDYearVIPPackage, EName: "yearvip", Name: "年会员大礼包",
		Type: TypeUse,
		Pay: map[int]int{TypePayMoney: 10000, TypePayCoin: -1, TypePayRMB: -1},
		Money: 10000, Coin: -1, RMB: -1,
		PayType: []int{TypePayMoney},
		IconID: 1005, Version: 10000, Discount: 1,
		Inventory: NoInventory, BuyLimitType: BuyLimitTypeInvalid, BuyLimitNum: -1,
		PropList: []PropInfo{
			{PID: IDExpCard, Num: 30},
			{PID: IDRenameCard, Num: 30},
			{PID: IDYearVIP, Num: 1},
		},
		InitNum: 0,
	},
	IDMonthVIPPackage: {
		PID: IDMonthVIPPackage, EName: "monthvip", Name: "月会员大礼包",
		Type: TypeUse,
		Pay: map[int]int{TypePayMoney: 1000, TypePayCoin: -1, TypePayRMB: -1},
		Money: 1000, Coin: -1, RMB: -1,
		PayType: []int{TypePayMoney},
		IconID: 1006, Version: 10000, Discount: 1,
		Inventory: NoInventory, BuyLimitType: BuyLimitTypeInvalid, BuyLimitNum: -1,
		PropList: []PropInfo{
			{PID: IDExpCard, Num: 2},
			{PID: IDRenameCard, Num: 2},
			{PID: IDMonthVIP, Num: 1},
		},
		InitNum: 0,
	},
}


